from anycloud import config

from base import Engine
from serial import SerialEngine
from multi import MultiProcessEngine
from ipython import IPythonEngine
from ec2 import EC2Engine

engine_types = {
    'serial': SerialEngine,
    'multiprocess': MultiProcessEngine,
    'ipython': IPythonEngine,
    'ec2': EC2Engine
}

_params = (
    config.StringParameter(
        'engine.type',
        "anyCloud engine to use.",
        config.oneof(*engine_types.keys())
    ),
)

def fromconfig():
    enginetype = config.get('engine.type')
    engineclass = engine_types[enginetype]
    return engineclass()

